import requests

def call_deepseek_api(api_key, params):
    """
    调用DeepSeek-V3 API的函数
    :param api_key: 您的API密钥
    :param params: 包含所有请求参数的字典
    :return: API的响应数据
    """
    # API端点
    api_endpoint = 'https://api.deepseek.com/v3/assistant'

    # 设置请求头
    headers = {
        'Authorization': f'Bearer {api_key}',
        'Content-Type': 'application/json'
    }

    # 发送POST请求
    response = requests.post(api_endpoint, headers=headers, json=params)

    # 检查响应状态码
    if response.status_code == 200:
        return response.json()
    else:
        raise Exception(f'API请求失败，状态码：{response.status_code}, 信息：{response.text}')

# 示例使用
if __name__ == '__main__':
    api_key = 'sk-ee9de35aea2245619463f4d35cf4293d'
    params = {
        'prompt': '你好，DeepSeek-V3！',
        'max_tokens': 100,
        # 其他参数...
    }
    try:
        result = call_deepseek_api(api_key, params)
        print(result)
    except Exception as e:
        print(e)